New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

emoji-regex

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emoji-regex

A regular expression to match all Emoji-only symbols as per the Unicode Standard.

9.2.2
Version published
Weekly downloads
156M
1.19%
Maintainers
2
Weekly downloads
 
Created

What is emoji-regex?

The emoji-regex npm package provides a regular expression to match all Emoji-only symbols as per the Unicode Standard. This package is useful for processing text that contains emojis, allowing developers to identify, validate, or manipulate emojis within strings.

What are emoji-regex's main functionalities?

Matching emojis in a string

This code sample demonstrates how to use emoji-regex to find all emojis in a given string. The regex is executed against a string containing emojis, and it will match each emoji character or sequence.

/(emojiRegex())/g.exec('I ❤️ emoji!')

Replacing emojis in a string

This code sample shows how to replace all emojis in a string with a specific word or character. In this case, every emoji in the string is replaced with the word 'emoji'.

'I ❤️ emoji!'.replace(emojiRegex(), 'emoji')

Counting emojis in a string

This code sample is used to count the number of emojis in a string. The match function returns an array of all emojis found, and the length property of the array indicates the total number of emojis.

'👍👍🏿'.match(emojiRegex()).length

Other packages similar to emoji-regex

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts